<template>
	<view class="tab_container">
		<view :class="curTabIndex === index ? 'tab_item active': 'tab_item'" v-for="(item, index) in tabs" :key="index"
		 @click="changeTab(index)">{{item}}</view>
	</view>
</template>

<script>
	export default {
		props: {
			tabs: {
				required: true,
				type: Array
			},
			curTabIndex: {
				type: Number,
				default: 0
			}
		},
		methods: {
			changeTab(index) {
				this.curTabIndex = index;
				this.$emit('tabChange', index);
			}
		}
	}
</script>

<style lang="less">
	.tab_container {
		height: 88rpx;
		display: flex;
		justify-content: space-between;
		padding: 0 48rpx;

		.tab_item {
			display: flex;
			align-items: center;
			justify-content: center;
			color: #676767;
			font-size: 30rpx;
			width: 184rpx;
		}

		.tab_item.active {
			font-weight: bold;
			border-bottom: 3rpx solid #EA4350;
		}
	}
</style>
